package com.tubeonfire.ajax.admin;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.tubeonfire.entity.Advertising;
import com.tubeonfire.model.admin.AdvertisingModel;

@SuppressWarnings("serial")
public class ProcessAdvertising extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws IOException {
		HttpSession session = request.getSession();
		String action = request.getParameter("action");
		if (action != null && action.equals("delete")) {
			String id = request.getParameter("id");
			Advertising obj = AdvertisingModel.byId(id, false);
			if (obj != null) {
				session.setAttribute("success", "Action success !");
				AdvertisingModel.delete(obj);
			}

		}
	}
}
